home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / AddOns / Components / InstallMaster 7.03 / Devfulldemo.exe / file0143.bin < prev    next >
Encoding:
Text File  |  1999-04-26  |  2.2 KB  |  78 lines

  1. //****************************************************************************
  2. // File: checkvga.c
  3. //
  4. // Purpose: example DLL file to interface with Wise Installation System
  5. //
  6. // Functions: LibMain, Check256Colors
  7. //
  8. //
  9. // Programmer:  John McMillan
  10. //
  11. //****************************************************************************
  12.  
  13. #include <windows.h>
  14. #include "wisedll.h"
  15.  
  16. char szErrorStr[] = "Your system does not support 256 colors, install anyway?";
  17.  
  18. //***********************************************************************
  19. // Function: LibMain
  20. //
  21. // Purpose: C function called from DLL entry point.
  22. //
  23. // Parameters: HINSTANCE hInst;   DLL instance handle
  24. //             WORD wSeg;         DLL data segment selector
  25. //             WORD cbHeapSize;   DLL initial heap size in bytes
  26. //             LPSTR lpszCmdLine; DLL command line
  27. //
  28. // Returns: 1 is success, 0 fail DLL load
  29. //
  30. // Comments:
  31. //
  32. // History:  Date       Author        Reason
  33. //
  34. //****************************************************************************
  35.  
  36. int CALLBACK LibMain(HINSTANCE hInst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine)
  37. {
  38.   return(1);
  39. }
  40.  
  41. //***********************************************************************
  42. // Function: Check256Colors
  43. //
  44. // Purpose: Check for support of at least 256 color display
  45. //
  46. // Parameters: 
  47. // LPDLLCALLPARAMS lpDllParams; Parameters from Wise
  48. //
  49. // Returns: TRUE if 256 colors is not supported on this machine
  50. //
  51. // Comments:
  52. //
  53. // History:  Date       Author        Reason
  54. //
  55. //****************************************************************************
  56.  
  57. BOOL CALLBACK __export Check256Colors(LPDLLCALLPARAMS lpDllParams)
  58. {
  59.    BOOL bNo256;
  60.    HDC hDC;
  61.    int nColors,nPlanes,nBitsPixel;
  62.  
  63.    bNo256 = TRUE;
  64.    if ((hDC = GetDC(lpDllParams->hWnd)) != NULL) {
  65.       nPlanes = GetDeviceCaps(hDC,PLANES);
  66.       nBitsPixel = GetDeviceCaps(hDC,BITSPIXEL);
  67.       nColors = 1 << (nPlanes * nBitsPixel);
  68.       if (nColors >= 256) bNo256 = FALSE;
  69.       ReleaseDC(lpDllParams->hWnd,hDC);
  70.    }
  71.    if (bNo256) {
  72.       if (MessageBox(lpDllParams->hWnd,szErrorStr,"Error",MB_APPLMODAL|MB_OKCANCEL) == IDOK) {
  73.          bNo256 = FALSE;
  74.       }
  75.    }
  76.    return bNo256; // Return TRUE if no 256 color support
  77. }
  78.